//
//  PersonageView.m
//  自定义快捷回复
//
//  Created by zl on 2019/9/27.
//  Copyright © 2019 zl. All rights reserved.
//

#import "PersonageView.h"

@implementation PersonageView

- (instancetype)initWithFrame:(CGRect)frame Sting:(NSString *)str{
    if (self == [super initWithFrame:frame]) {
        self.Str1 = str;
        [self setupSubViews];
    }
    return self;
}
- (void)setupSubViews {
    JDCategoryLeftTabelView *leftView = [[JDCategoryLeftTabelView alloc] init];
    leftView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.leftView = leftView;
    self.leftView.String = self.Str1;
    [self.leftView LoadData];
    [self addSubview:leftView];
    [leftView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self);
        make.top.equalTo(self);
        make.bottom.equalTo(self);
        make.width.equalTo(@(100));
    }];
    __weak typeof(self) weakSelf = self;
    [leftView setCellSelectedBlock:^(NSIndexPath *indexPath, NSString *String) {
        weakSelf.rightView.Str = String;
        
        [weakSelf.rightView LoadData];
        [weakSelf.rightView reloadData];
//        [weakSelf.rightView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionNone animated:YES];
    }];
    RightTableView *rightView = [[RightTableView alloc]initWithFrame:CGRectMake(101, 0, kScreenWidth - 101, 300) style:UITableViewStylePlain Sting:self.Str1];
    self.rightView = rightView;
    rightView.separatorStyle = UITableViewCellSeparatorStyleNone;
    rightView.pagingEnabled = YES;
    [self addSubview:rightView];
    [rightView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self);
        make.left.equalTo(leftView.mas_right).offset(1);
        make.right.equalTo(self);
        make.bottom.equalTo(self);
    }];
}

@end
